package com.solution.admin.promotion.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.solution.admin.promotion.dao.PromotionTargetDao;
import com.solution.admin.promotion.entity.PromotionTargetEntity;
import com.solution.common.dao.impl.BaseDaoImpl;
import com.solution.common.page.PageBean;
import com.solution.common.page.PageParam;

/**
 * 活动对象信息DAO实现
 * 
 * @author xu_cc
 * @date 2017-09-27 23:25:28
 */
@Repository
public class PromotionTargetDaoImpl extends BaseDaoImpl<PromotionTargetEntity> implements PromotionTargetDao {

    /**
     * 保存活动对象信息信息
     * 
     * @param promotionTargetEntity
     * @return
     * @author xu_cc
     * @date 2017-09-27 23:25:28
     */
    @Override
    public long savePromotionTarget(PromotionTargetEntity promotionTargetEntity) {
        return super.insert(promotionTargetEntity);
    }

    /**
     * 分页查询活动对象信息信息
     * 
     * @param pageParam
     *            分页对象
     * @param promotionTarget
     *            分页参数
     * @return PageBean 分页参数及数据
     * @author xu_cc
     * @date 2017-09-27 23:25:28
     */
    public PageBean listPromotionTargetPage(PageParam pageParam, Map<String, Object> param) {
        return super.listPage(pageParam, param);
    }

    /**
     * 更新活动对象信息
     * 
     * @param promotionTargetEntity
     * @return
     * @author xu_cc
     * @date 2017-09-27 23:25:28
     */
    @Override
    public int updatePromotionTarget(PromotionTargetEntity promotionTargetEntity) {
        return super.update(promotionTargetEntity);
    }

    /**
     * 删除活动对象信息
     * 
     * @param promotionTargetId
     * @return
     * @author xu_cc
     * @date 2017-09-27 23:25:28
     */
    public int deleteById(Long promotionId) {
        return super.deleteById(promotionId);
    }

    /**
     * 根据条件查询活动对象信息
     * 
     * @param param
     * @return
     * @author xu_cc
     * @date 2017-09-27 23:25:28
     */
    @Override
    public List<PromotionTargetEntity> listPromotionTarget(Map<String, Object> param) {
        return super.listBy(param);
    }
    
    /**
	 * 查询当前客户是否属于指定活动的活动对象
	 * @param param
	 * @return
	 * @author llp
	 */
	public List<PromotionTargetEntity> listPromotionTargetForShoppingCheckOut(Map<String, Object> param){
		return getSessionTemplate().selectList(getStatement("listPromotionTargetForShoppingCheckOut"), param);
	}
}
